home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
mktil16a.zip
/
HEADERS.ZIP
/
WINDOWS.H
< prev
Wrap
C/C++ Source or Header
|
1994-09-19
|
3KB
|
96 lines
#define NORMAL_WINDOW 1
#define FILE_SELECT_WINDOW 2
struct WINDOW
{
byte huge *
int window_x, window_y;
word window_width, window_height;
} window;
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
void make_window(int x, int y, word width, word height,
byte window_color, byte border_color, byte option)
{
word a;
word dest_tmp, dest_tmp2, tmp;
if (window!=NULL) return;
window=(byte huge *)halloc((long)width*height,1);
if (window==NULL)
{
printf("error allocating window memory\n");
return;
}
get_image(x,y,window,width,height);
window_x=x; window_y=y;
window_width=width; window_height=height;
if (option=NORMAL_WINDOW)
{
tmp=(y<<8)+(y<<6)+x;
memset(&screen[tmp],border_color,width);
dest_tmp=tmp+320;
dest_tmp2=tmp+width-1+320;
for (a=1;a<height-1;a++)
{
memset(&screen[dest_tmp+1],window_color,width-1);
screen[dest_tmp]=border_color;
screen[dest_tmp2]=border_color;
dest_tmp+=320;
dest_tmp2+=320;
}
tmp=((y+height-1)<<8)+((y+height-1)<<6)+x;
memset(&screen[tmp],border_color,width);
}
else if (option=FILE_SELECT_WINDOW)
{
tmp=(y<<8)+(y<<6)+x;
memset(&screen[tmp],border_color,width);
dest_tmp=tmp+320;
dest_tmp2=tmp+width-1+320;
for (a=1;a<height-1;a++)
{
memset(&screen[dest_tmp+1],window_color,width-1);
screen[dest_tmp]=border_color;
screen[dest_tmp2]=border_color;
dest_tmp+=320;
dest_tmp2+=320;
}
tmp=((y+height-1)<<8)+((y+height-1)<<6)+x;
memset(&screen[tmp],border_color,width);
tmp=((y+10)<<8)+((y+10)<<6)+x;
memset(&screen[tmp],border_color,width);
tmp=((y+20)<<8)+((y+20)<<6)+x;
memset(&screen[tmp],border_color,width);
tmp=((y+height-11)<<8)+((y+height-11)<<6)+x;
memset(&screen[tmp],border_color,width);
tmp=((y+height-21)<<8)+((y+height-21)<<6)+x;
memset(&screen[tmp],border_color,width);
put_string(x+2+32,y+height-9,"CANCEL",15,NORMAL);
}
}
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
void remove_window(void)
{
if (window==NULL) return;
put_image(window_x,window_y,window,window_width,window_height,SET);
hfree(window);
window=NULL;
}